package com.huat.sportmeetingmanagement.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.huat.sportmeetingmanagement.dao.ProjectDao;
import com.huat.sportmeetingmanagement.entity.Project;
import com.huat.sportmeetingmanagement.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ProjectServiceImpl implements ProjectService {
    @Autowired
    ProjectDao projectDao;


    @Override
    public Page<Project> getProjects(Project project) {
        PageHelper.startPage(project.getPageNum(),project.getPageSize());
        return projectDao.getProjects(project);
    }

    @Override
    public Integer addProject(Project project) {
        return projectDao.addProject(project);
    }

    @Override
    public Integer updateProject(Project project) {
        return projectDao.updateProject(project);
    }

    @Override
    public Integer deleteProject(String id) {
        return projectDao.deleteProject(id);
    }

    @Override
    public Project getProjectById(Integer id) {
        return projectDao.getProjectById(id);
    }

    @Override
    public Project getProjectByNo(String No) {
        return projectDao.getProjectByNo(No);
    }

    @Override
    public Integer deleteProjects(String[] ids) {
        return projectDao.deleteProjects(ids);
    }

    @Override
    public List<Project> queryAllProjectsByStatus(Integer status) {
        return projectDao.queryAllProjectsByStatus(status);
    }
}
